<?php
/**
 * User: Administrator
 * Date: 12-2-29
 * Time: 下午5:58
 */
require 'lib/lib.php';
include 'islogin.php';

$actinfo='';
$include_src='';
$f_title='';
$act = isset($_GET['act']) ? $_GET['act'] : '';
$mid = isset($_GET['mid']) ? $_GET['mid']:0;
$manage=new Manage();

switch ($act) {
    case 'atch':{
        $aid=isset($_GET['aid'])?$_GET['aid']:'';
        $apact=isset($_GET['apact'])?$_GET['apact']:'';
        if($manage->altacth($mid,$aid,$apact)){
            $actinfo=$actinfo=Fun::echoinfo('操作成功！','succeed');
        }else{
            $actinfo=Fun::echoinfo($manage->errorinfo[2],'error');
        }
        $include_src = 'manage_alt.php';
        break;
    }
    case 'showfiled':{
        $fid=isset($_GET['fid'])?$_GET['fid']:'';
        $apact=isset($_GET['apact'])?$_GET['apact']:'';
        if($manage->altshowfiledid($mid,$fid,$apact)){
            $actinfo=$actinfo=Fun::echoinfo('操作成功！','succeed');
        }else{
            $actinfo=Fun::echoinfo($manage->errorinfo[2],'error');
        }
        $include_src = 'manage_alt.php';
        break;
    }
    case 'alt':{

        if(isset($_POST['cname'])&&isset($_POST['ctpl'])&&isset($_POST['lfile'])&&isset($_POST['ltpl'])
            &&isset($_POST['ftpl']) &&isset($_POST['nrule'])&&isset($_POST['pnum'])&&isset($_POST['fpath'])){

            if($manage->alt($_POST['cname'],$_POST['ctpl'],$_POST['lfile'],$_POST['ltpl'],$_POST['ftpl'],
                            $_POST['nrule'],$_POST['pnum'],$_POST['fpath'],$mid)){
                $actinfo=$actinfo=Fun::echoinfo('修改成功！','succeed');
            }else{
                $actinfo=Fun::echoinfo($manage->errorinfo[2],'error');
            }

        }

        $include_src = 'manage_alt.php';
        break;
    }
    case 'del':{
        if( isset($_GET['confirm'])&&$_GET['confirm']==='yes'){

            if($manage->del($mid)){
                $actinfo = Fun::echoinfo('删除成功！','succeed');
            }else{
                $actinfo = Fun::echoinfo($manage->errorinfo[2],'error');
            }

        }

        $include_src = 'manage_del.php';
        break;
    }
    default:{
        if(isset($_POST['cname'])&&isset($_POST['ctpl'])&&isset($_POST['lfile'])&&isset($_POST['ltpl'])
            &&isset($_POST['ftpl']) &&isset($_POST['nrule'])&&isset($_POST['pnum'])&&isset($_POST['fpath'])){
            if($manage->add($_POST['cname'],$_POST['ctpl'],$_POST['lfile'],$_POST['ltpl'],$_POST['ftpl'],
                            $_POST['nrule'],$_POST['pnum'],$_POST['fpath'],$mid)){
                $actinfo= Fun::echoinfo('建立成功！','succeed');
            }else{
                $actinfo=$actinfo=Fun::echoinfo($manage->errorinfo[2],'error');
            }

        }
        $include_src = 'manage_add.php';
        break;
    }
}

include ADMIN_ABS_TPL_SRC.'index.php';



